from django.urls import re_path
from haystack.routers import DefaultRouter

from recruit.views import RecruitAPIView, RecruitNewAPIView, EnterpriseHowAPIView, RecruitInfoView, UpdateVisitsView
from . import views

urlpatterns = [
    re_path(r'^recruits/search/recommend/$', RecruitAPIView.as_view()),
    re_path(r'^recruits/search/latest/$', RecruitNewAPIView.as_view()),
    re_path(r'^enterprise/search/hotlist/$', EnterpriseHowAPIView.as_view()),
    re_path(r'^recruits/(?P<id>\d+)/$', RecruitInfoView.as_view()),
    re_path(r'^recruits/(?P<id>\d+)/visit/$', UpdateVisitsView.as_view()),
    # 收藏企业
    re_path(r'^enterprise/(?P<id>\d+)/collect/$', views.CollectEnterpriceView.as_view()),
    re_path(r'^enterprise/(?P<id>\d+)/cancelcollect/$', views.CollectEnterpriceViewS.as_view()),
    # 收藏职位
    re_path(r'^recruits/(?P<id>\d+)/collect/$', views.CollectRecruitsView.as_view()),
    re_path(r'^recruits/(?P<id>\d+)/cancelcollect/$', views.CollectRecruitsViewS.as_view()),
    # 企业浏览
    re_path(r'^enterprise/(?P<id>\d+)/visit/$', views.VisitAddView.as_view()),
    #  企业详情
    re_path(r'^enterprise/(?P<id>\d+)/$', views.EnterpriseModelView.as_view()),
    # 获取热门城市
    re_path(r'^city/hotlist/$', views.HotCityView.as_view()),
    re_path(r'^recruits/search/city/keyword/$', views.SearchRecruitsView.as_view())

]

# router = DefaultRouter()
# router.register('recruits/search/city/keyword', views.SearchRecruitsView, base_name='recruits')
# urlpatterns += router.urls
